package com.zhijian.medical.entity.vo.response;

import com.zhijian.medical.enums.DyeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 脱水前的样本放置容器表 回显vo
 *
 * @author HCG
 * @version 1.0
 * @date 2022-11-17 15:24:59
 */
@Getter
@Api(tags = "脱水前的样本放置容器表回显vo")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BeforeDyeVo implements Serializable {

    private static final long serialVersionUID = -1;

    /**
     * 主键id
     */
    @ApiModelProperty("主键id")
    private Long id;

    /**
     * 容器标识
     */
    @ApiModelProperty("容器标识")
    private String containerNumber;

    /**
     * 状态
     */
    @ApiModelProperty("状态")
    private Byte status;

    /**
     * 状态字符串
     */
    @ApiModelProperty("状态字符串")
    private String statusStr;

    /**
     * 标本id集合，以英文逗号隔开
     */
    @ApiModelProperty("标本id集合，以英文逗号隔开")
    private String sampleIds;

    /**
     * 样本数量
     */
    @ApiModelProperty("样本数量")
    private Integer sampleCount;

    /**
     * 操作时间
     */
    @ApiModelProperty("操作时间")
    private String createTime;

    /**
     * 样本列表
     */
    @ApiModelProperty("样本列表")
    private List<String> sampleList;

    /**
     * 流程编号
     */
    @ApiModelProperty("流程编号")
    private String processNumber;

    public void setProcessNumber(String processNumber) {
        this.processNumber = processNumber;
    }

    public void setSampleList(List<String> sampleList) {
        this.sampleList = sampleList;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setContainerNumber(String containerNumber) {
        this.containerNumber = containerNumber;
    }

    public void setStatus(Byte status) {
        this.status = status;
        if (Objects.isNull(status)) {
            this.statusStr = null;
            return;
        }
        DyeEnum anEnum = DyeEnum.getByCode(status.intValue());
        this.statusStr = Objects.nonNull(anEnum) ? anEnum.getDesc() : null;
    }

    public void setStatusStr(String statusStr) {
    }

    public void setSampleIds(String sampleIds) {
        this.sampleIds = sampleIds;
        if (StringUtils.isBlank(sampleIds)) {
            this.sampleCount = 0;
            return;
        }
        this.sampleCount = sampleIds.split(",").length;
    }

    public void setSampleCount(Integer sampleCount) {
        this.sampleCount = sampleCount;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}